// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

const db = cloud.database()
const _ = db.command
// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()

  let {title, description} = event
  return await db.collection("lostFoundList").where(_.or(
    [
    {
      title: db.RegExp({
        regexp: '.*' + title,
        options: 'i',
      })
    },
    {
      description: db.RegExp({
        regexp: '.*' + description,
        options: 'i',
      })
    }
    ])  
 ).get()
}